
import 'package:flutter/material.dart';
import 'package:flutter_test_provider/gongxiang/gongxiang_share_data.dart';
import 'package:provider/provider.dart';

class ProviderCreatePage extends StatefulWidget {
  @override
  _ProviderCreatePageState createState() => _ProviderCreatePageState();
}
///test
class _ProviderCreatePageState extends State<ProviderCreatePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("provider_create"),
      ),
      body: Container(
        child: Provider(
          create: (_) => ShareData1(),
          child: ProviderCreateChildWidget(),
        ),
      ),
    );
  }
}


class ProviderCreateChildWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    int count = Provider.of<ShareData1>(context).count;
    return Text(count.toString());
  }
}
